package com.clayecloud.lib_common.room.services;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;

import com.clayecloud.lib_common.room.entity.ClientBase;

import io.reactivex.Flowable;
import io.reactivex.Observable;
import io.reactivex.Single;

@Dao
public interface ClientBaseService {

    /**
     * 增加clientBase
     * @param clientBase
     * @return
     */
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    Single<Long> insertClientBase(ClientBase clientBase);

    /**
     * 删除clientBase
     * @param clientBase
     * @return
     */
    @Delete
    int deleteClientBase(ClientBase clientBase);


    /**
     * 更新clientBase
     * @param clientBase
     * @return
     */
    @Update
    Single<Integer> updateClientBase(ClientBase clientBase);


    /**
     * 根据id查询clientBase
     * @param id
     * @return
     */
    @Query("select * from clientBase where id in (:id)")
    LiveData<ClientBase> getClientBaseById(int id);


    /**
     * 根据id查询clientBase
     * @param id
     * @return
     */
    @Query("select * from clientBase where id in (:id)")
    Single<ClientBase> getClientBaseByIdWithSingle(int id);

}
